package controller.states;

import controller.Controller;
import controller.Controller.StateType;
import controller.IState;

/*
 * 
 * GameOverState class
 * 
 * State used when the player runs out of lives and the game must be restarted.
 * When the user presses the Enter key the game loads the initial level.
 * 
 */

public class GameOverState implements IState {

	Controller controller;
	public StateType state;

	/**
	 * GameOverState
	 * 
	 * constructs the gameOverState, based upon the controller that it is passed
	 * 
	 * @param c
	 */
	public GameOverState(Controller c) {
		controller = c;
		state = StateType.GAMEOVER;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see controller.IState#getState()
	 */
	@Override
	public StateType getState() {
		return state;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see controller.IState#handleKeyPressed(int)
	 */
	@Override
	public void handleKeyPressed(int keyCode) {
		return;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see controller.IState#handleKeyReleased(int)
	 */
	@Override
	public void handleKeyReleased(int keyCode) {
		if (keyCode == 10) {
			controller.setState(new VictoryState(controller));
		}
	}

}
